Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP - (clang-tidy): Modernize code using clang-tidy #227

Merged
merged 11 commits into from
Jul 5, 2021

Conversation

ladislas
Copy link
Member

@ladislas ladislas commented Apr 22, 2021

Following #226, this PR is a wip showing how clang-tidy can improve code readability and good practices

@ladislas ladislas force-pushed the ladislas/feature/clang-tidy-modernize branch from 34a8ccf to b2b2812 Compare April 22, 2021 08:23
@codecov
Copy link

codecov bot commented Apr 22, 2021

Codecov Report

Merging #227 (9011349) into develop (52f1ee3) will not change coverage.
The diff coverage is n/a.

❗ Current head 9011349 differs from pull request most recent head 7f4b8d3. Consider uploading reports for the commit 7f4b8d3 to get more accurate results
Impacted file tree graph

@@            Coverage Diff            @@
##           develop      #227   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           44        44           
  Lines          874       874           
=========================================
  Hits           874       874           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 52f1ee3...7f4b8d3. Read the comment docs.

@ladislas ladislas force-pushed the ladislas/feature/clang-tidy-modernize branch from b2b2812 to 2b5ecb8 Compare April 22, 2021 14:35
@ladislas ladislas force-pushed the ladislas/feature/clang-tidy-modernize branch from 2b5ecb8 to 066f414 Compare May 5, 2021 12:59
@ladislas ladislas force-pushed the ladislas/feature/clang-tidy-modernize branch from 066f414 to f99b999 Compare May 20, 2021 11:44
@codeclimate
Copy link

codeclimate bot commented May 20, 2021

Code Climate has analyzed commit f99b999 and detected 0 issues on this pull request.

View more on Code Climate.

@sonarcloud
Copy link

sonarcloud bot commented May 20, 2021

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@ladislas ladislas force-pushed the ladislas/feature/clang-tidy-modernize branch 18 times, most recently from 7cc15f2 to e0e1dd3 Compare July 2, 2021 12:05
@ladislas ladislas force-pushed the ladislas/feature/clang-tidy-modernize branch from e0e1dd3 to 4f6425e Compare July 5, 2021 07:52
@ladislas ladislas force-pushed the ladislas/feature/clang-tidy-modernize branch from 4f6425e to e8f43cb Compare July 5, 2021 10:35
When running clang-tidy from the command line, it was not able to find
std headers such as chrono, cstddef, etc.

This is because the compile database did not have all the include path
known to the compiler (arm-none-eabi-g{cc,++}) and therefore clang-tidy
was falling back to clang's own includes

Fix from: https://gitlab.kitware.com/cmake/cmake/-/issues/20912#note_795673
The target can be used to run clang-tidy on changed .h and .cpp files in
the current branch
Add:

- 10, 100, 1000
- hours/minutes - 60, 3600
- baudrates - 9600, 115200
In particular, the following rules were breaking LogKit because of
macros:

- cppcoreguidelines-pro-bounds-array-to-pointer-decay
- cppcoreguidelines-pro-bounds-pointer-arithmetic
- cppcoreguidelines-pro-type-vararg

We should find a way to fix this and still use the rules.
@ladislas ladislas force-pushed the ladislas/feature/clang-tidy-modernize branch from e8f43cb to e8702a8 Compare July 5, 2021 10:37
@ladislas ladislas force-pushed the ladislas/feature/clang-tidy-modernize branch from 9011349 to 7f4b8d3 Compare July 5, 2021 10:53
@ladislas ladislas merged commit eda4f2a into develop Jul 5, 2021
@sonarcloud
Copy link

sonarcloud bot commented Jul 5, 2021

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@ladislas ladislas deleted the ladislas/feature/clang-tidy-modernize branch July 12, 2021 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants